import React, { Component } from "react";
import { Link, Route, Routes } from "react-router-dom";

import About from "./pages/About";
import Home from "./pages/Home";

import "./App.css";

export default class App extends Component {
  render() {
    return (
      <div>
        <h2>Router</h2>
        {/* 编写路由链接 */}
        <nav>
          <Link to="/about">About</Link>&nbsp;|&nbsp;
          <Link to="/home">Home</Link>
        </nav>
        <hr />
        {/* 注册路由 */}
        <Routes>
          <Route path="/" element={<div></div>}></Route>
          <Route path="/about" element={<About />} />
          <Route path="/home" element={<Home />} />
        </Routes>
      </div>
    );
  }
}
